package com.chixing.config;

import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

import java.io.IOException;


@Component
public class MyFilter implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
        // 确保过滤器不会错误地处理静态资源请求
        if (httpRequest.getRequestURI().startsWith("/assets/")) {
            filterChain.doFilter(httpRequest, servletResponse);
            return;
        }
        // 其他逻辑
        filterChain.doFilter(servletRequest, servletResponse);
    }
}
